package jaux.tank.generator.domain;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
public class TankApplication {

    private static final String DEFAULT_APP_NAME = "myapp1";

	public enum ApplicationType {
        MONOLITH, MICROSERVICE, GATEWAY
    }

    public enum AuthenticationType {
        TOKEN, JWT,  OAUTH2
    }


    public enum BuildTool {
        MAVEN, GRADLE
    }

    public enum CacheProvider {
        EHCACHE,
        CAFFEINE,
        HAZELCAST,
        INFINISPAN,
        MEMCACHED,
        REDIS,
        NO
    }

    public enum ClientFramework {
    	VUE, 
//        ANGULARX, 
//        ANGULAR, 
//        REACT, 
//        SVELTE, 
        NO
    }

    // clientPackageManager目前只有一个可能值，因此不需要枚举

    // clientTheme和clientThemeVariant由于可能接受任意值，因此保留为String

    public enum DatabaseType {
        SQL, 
        MONGODB, 
//        CASSANDRA, 
//        COUCHBASE, 
        NO
    }

    public enum DevDatabaseType {
        H2DISK, H2MEMORY, OTHER // OTHER表示生产数据库类型
    }

    // dtoSuffix和entitySuffix允许自定义后缀或为空字符串，因此使用String

    // enableHibernateCache, enableSwaggerCodegen, enableTranslation, skipClient, skipServer, skipUserManagement, reactive均为布尔值

    // languages, packageName, serverPort由于是更自由形式的值，使用String表示

    public enum ProdDatabaseType {
        MYSQL,
//        MARIADB, 
//        MSSQL, 
//        POSTGRESQL, 
        ORACLE, 
//        NO
    }

    public enum MessageBroker {
        KAFKA, PULSAR, NO
    }

    public enum ServiceDiscoveryType {
        CONSUL, EUREKA, NO
    }

    public enum TestFrameworks {
        CYPRESS, PROTRACTOR, CUCUMBER, GATLING
    }

    public enum SearchEngine {
        ELASTICSEARCH, COUCHBASE, NO
    }

    public enum Websocket {
        SPRING_WEBSOCKET, NO
    }

    public TankApplication() {
    	this(DEFAULT_APP_NAME);
    }
    
    public TankApplication(String name) {
    	this.id = UUID.randomUUID().toString();
    	this.name = name;
    }
    
    // 属性定义
    private final String id;
    private ApplicationType applicationType = ApplicationType.MONOLITH;
    private AuthenticationType authenticationType = AuthenticationType.TOKEN;
    private String name = DEFAULT_APP_NAME;
    private BuildTool buildTool = BuildTool.MAVEN;
    private CacheProvider cacheProvider = CacheProvider.EHCACHE;
    private ClientFramework clientFramework = ClientFramework.VUE;
    private String clientPackageManager ="npm";
    private String clientTheme ="";
    private String clientThemeVariant ="";
    private DatabaseType databaseType = DatabaseType.SQL;
    private DevDatabaseType devDatabaseType = DevDatabaseType.OTHER;
    private String dtoSuffix ="DTO";
    private boolean enableHibernateCache = true;
    private boolean enableSwaggerCodegen = false;
    private boolean enableTranslation = true;
    private boolean enableS3 = false;
    private boolean enableFaceRecognition = false;
    private String entitySuffix;
    private String tankPrefix = "";
    private List<String> languages = new ArrayList<>(Arrays.asList("zh"));
    private String nativeLanguage = "zh";
    private String packageName ="jaux.tank.myapp1";
    private ProdDatabaseType prodDatabaseType = ProdDatabaseType.MYSQL;
    private boolean reactive;
    private SearchEngine searchEngine ;
    private Integer serverPort = 8080;
    private ServiceDiscoveryType serviceDiscoveryType;
    private boolean skipClient;
    private boolean skipServer;
    private boolean skipUserManagement;
    private List<TestFrameworks> testFrameworks = new ArrayList<>();
    private Websocket websocket;

    private List<TankEntity>  entities = new ArrayList<>();
}
